﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ManageNewsUserControl.ascx.cs"
    Inherits="JM.JCY.SharePointComponent.News.ManageNews.ManageNewsUserControl" %>


<script type="text/javascript">
    $(document).ready(function () {

    });

    function RedirectToManageNews(sender) {
        sender.href = "ManageNews.aspx?Category=" + $("#<%=hfCategory.ClientID %>").val();
    }

    function RedirectToCreateNews(sender) {
        sender.href = "CreateNews.aspx?Category=" + $("#<%=hfCategory.ClientID %>").val();
    }

    function document.onkeydown() {
        if (event.keyCode == 13) {
            event.keyCode = 9;
            event.returnValue = false;
            document.getElementById('<%= imgSubmit.ClientID %>').focus();
            document.getElementById('<%= imgSubmit.ClientID %>').click();
        }
    }

    function ReceiveCallback(arg, context) {
        var r = arg.split("|@|@|@");
        var container = document.getElementById(context);
        container.innerHTML = r[0];

    }

    function trim(str) {
        return str.replace(/(^\s*)|(\s*$)/g, "");
    }

    function RedirectToViewNews(sender, newsId) {
        sender.href = "EditNews.aspx?NewsId=" + newsId + "&Category=" + $("#<%=hfCategory.ClientID %>").val();
        return false;
    }
</script>
<style type="text/css">
    .ms-input /* Set textbox's width of dtEffDateFrom and dtEffDateTo */
    {
        width: 75px;
    }
    
    table.form td.nopaddingleft
    {
        padding-left: 0px;
        padding-top: 0px;
        vertical-align: top;
        font-family: Calibri;
        font-size: 12px;
    }
</style>

<div>
    <table class="main">
        <tr>
           <td valign="top" width="100%" runat="server" id="tdContent">
                <table class="content" width="98%">
                    <tr>
                        <td style="padding: 5px;">
                            <table width="100%" class="title">
                                <tr>
                                    <td width="60%">
                                        <h2><img src="/_layouts/JM.JCY.Resource/images/新闻大.png" width="32" />
                                           <asp:Label ID="lblDisplay" runat="server"></asp:Label>
                                        </h2>
                                    </td>
                                    <td align="right">
 <img src="/_layouts/JM.JCY.Resource/images/plus.png" width="12"/>
                                     <asp:LinkButton ID="lkbCreateNews" runat="server" OnClientClick="RedirectToCreateNews(this)"></asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <hr />
                            <table width="100%" class="form">
                                <tr>
                                    <td>
                                        标题
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtSubject" runat="server" Width="480"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        发布时间
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td class="nopaddingleft">
                                        <table cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="left" valign="top" class="nopaddingleft">
                                                    <sharepoint:datetimecontrol id="dtEffDateFrom" calendarimageurl="/_layouts/JM.JCY.Resource/images/calendar.jpg"
                                                        datepickerframeurl="/_layouts/iframe.aspx" dateonly="true" calendar="Gregorian"
                                                        localeid="2057" runat="server"></sharepoint:datetimecontrol>
                                                </td>
                                                <td>
                                                    -
                                                </td>
                                                <td align="left" valign="top" class="nopaddingleft">
                                                    <sharepoint:datetimecontrol id="dtEffDateTo" calendarimageurl="/_layouts/JM.JCY.Resource/images/calendar.jpg"
                                                        datepickerframeurl="/_layouts/iframe.aspx" dateonly="true" calendar="Gregorian"
                                                        localeid="2057" runat="server"></sharepoint:datetimecontrol>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        状态
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td> 
                                        <asp:DropDownList ID="ddlStatus" runat="server" Width="250">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3" class="button">
                                        <asp:ImageButton ID="imgSubmit" runat="server" ImageUrl="~/_layouts/JM.JCY.Resource/images/search.png"
                                            OnClick="imgSubmit_Click" />
                                        <asp:ImageButton ID="imgCancel" runat="server" 
                                            ImageUrl="~/_layouts/JM.JCY.Resource/images/cancel.png" 
                                            onclick="imgCancel_Click" />
                                    </td>
                                </tr>
                            </table>
                            <table width="100%" class="list">
                                <tr>
                                    <td>
                          
                                        <div id="content">
                                           <asp:GridView ID="gvBC" runat="server" AutoGenerateColumns="False" BorderWidth="0px"
                                                GridLines="Horizontal" CssClass="altrowstablebc" width="100%" 
                                                OnRowDataBound="gvBC_DataBound" EnableModelValidation="True">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="发布日期" ItemStyle-Width="15%">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblEffDate" runat="server" Text='<%# Eval("CREATED_TIME") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <ItemStyle Width="15%"></ItemStyle>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="照片" ItemStyle-Width="25%">
                                                        <ItemTemplate>
                                                            <asp:Image ID="imgPic" runat="server" ImageUrl='<%# Eval("ImageUrl") %>' Width="144"
                                                                Height="90" />
                                                        </ItemTemplate>
                                                        <ItemStyle Width="25%"></ItemStyle>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="主题" ItemStyle-Width="25%">
                                                        <ItemStyle Width="25%"></ItemStyle>
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="lbSubject" runat="server" Text='<%#Eval("Subject")%>' OnClientClick='<%# String.Format("RedirectToViewNews({0},{1})","this",Eval("ID")) %>'></asp:LinkButton>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="内容">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblContent" runat="server" Text='<%#Eval("Summary")%>'></asp:Label>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                            </asp:GridView>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <br />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>

<asp:HiddenField ID="hfCategory" runat="server" />
